<?php foreach($list_topic as $k=>$v):?>
<div class="topic sd1">
	<div class="topic-img">
		<?php if(!empty($v->imgpath)):?>
		<a class="cb" href="<?php echo $v->img_big_path;?>">
			<img src="<?php echo $v->imgpath;?>"/>
		</a>
		<?php elseif(!empty($v->media)):?>
		<a class="cb" href="<?php echo site_url('c=topic&m=media&id='.$v->id);?>">
		<?php html_img('bg-media-1.jpg');?>
		</a>
		<?php endif;?>
	</div>
	<div class="topic-smy c3 fs2"><?php echo nl2br($v->smy);?></div>
	<div class="topic-cat c3 fs2">
		<?php echo getCatFname($list_cat, $v->cat_id);?>
	</div>
	<div class="topic-opt">
		<a class="topic-opt-favo c3 fs2 fl btn-ajax" 
			afterdo="dig_after_do"
			href="<?php echo site_url('c=topic&m=dig&type=good&id='.$v->id);?>">
			<?php echo $v->count_dig_good;?>
		</a>
		
		<div class="topic-opt-view c2 fs2 fr">
			<?php if($v->favo_status == 'normal'):?>
        		<a class="fs2 btn-ajax" 
            		href="<?php echo site_url('c=topic&m=favo&id='.$v->id);?>"
            		afterdo="favo_after_do"
            	>
        			<span class="favo-title">收藏</span> <span class="favo-count c3"><?php echo $v->count_favo;?></span>
        		</a>
			<?php elseif($v->favo_status == 'unfavo'):?>
        		<span class="c3" > 收藏<?php echo $v->count_favo;?> </span>
			<?php elseif($v->favo_status == 'favoed'):?>
        		<a class="fs2 btn-ajax" 
            		href="<?php echo site_url('c=topic&m=favo&id='.$v->id);?>"
            		afterdo="favo_after_do"
            	>
        			<span class="favo-title">取消收藏</span> 
        			<span class="favo-count c3"><?php echo $v->count_favo;?></span>
        		</a>
			<?php endif;?>
			
    		&nbsp;
			<a href="<?php echo site_url('c=topic&m=view&id='.$v->id);?>">详细</a>
		</div>
		<div style="clear: both;"></div>
	</div>
	<div class="topic-postinfo">
		<div class="topic-postinfo-avatar">
    		<a href="<?php echo site_url('c=member&m=index&id='.$v->poster_id);?>">
    			<img src="http://www.gravatar.com/avatar/<?php echo md5($v->posteremail);?>?s=30&d=&r=X"/>
    		</a>
		</div>
		<div class="topic-postinfo-postername c2 fs2"><?php echo $v->postername;?></div>
		<div class="topic-postinfo-posttime fs2 c3"><?php show_date($v->atime);?></div>
	</div>
</div>
<?php endforeach;;?>


<script>
function dig_after_do(msg,$elt){
	if(msg.status == 'succ'){
		$elt.empty().html(msg.data.count);
		return false;
	}
	
	return true;
}

function favo_after_do(msg,$elt){
	if(msg.status == 'succ'){
		$elt.find('.favo-count').empty().html(msg.data.count_favo);
		$elt.find('.favo-title').empty().html(msg.msg);
		return false;
	}
	return true;
}

</script>